<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1" %>
<%@ page import="Singleton.Application" %>
<%@ page import="Singleton.Local" %>
<%@ page import="utils.Functions" %>
<%@ page import="java.util.Calendar" %>
<%@ page import="java.util.GregorianCalendar" %>
<%@ page import="java.text.SimpleDateFormat"%>

<%
    
	SimpleDateFormat dateFormat = new SimpleDateFormat(Local.get("shortDateFormat")); 
	GregorianCalendar[] week = new GregorianCalendar[7];
	
	week[0] = new GregorianCalendar();
	if (!Functions.isNullOrEmpty(request.getParameter("date"))) {
		week[0].setTime(dateFormat.parse(request.getParameter("date")));
	} else {
		week[0].setTime(new java.util.Date());
	}
	week[0] = Functions.getFirstDayOfWeek(week[0]);
	for (int i=1;i<week.length;i++) {
		week[i]=Functions.addDays(week[0],i);
	}
	
	GregorianCalendar nextDate = new GregorianCalendar();
	nextDate.setTime(week[6].getTime());
	nextDate.add(Calendar.DAY_OF_YEAR,1);
	GregorianCalendar prevDate = new GregorianCalendar();
	prevDate.setTime(week[0].getTime());
	prevDate.add(Calendar.DAY_OF_YEAR,-1);
	String nextLinkDate = dateFormat.format((java.util.Date)((GregorianCalendar)nextDate).getTime());
	String prevLinkDate = dateFormat.format((java.util.Date)((GregorianCalendar)prevDate).getTime());
	
%>    
<%@page import="java.util.Date"%>

<table width="100%" cellpadding="0" cellspacing="0" border="0" id="applicationcontainer">
<tr>
    <td id="leftNav" valign="top" width="190">
    
                <div class="modulecontainer sidebar">
            <div class="first">
                <span class="first"></span>
                <span class="last"></span>
            </div>
            <div style="text-align:center;">

                <!-- Mini calendrier -->
                        <div style="border-top:1px dotted #ccc;padding-top:5px;margin-top:5px;"><%= Singleton.Local.get("today_announcement") %>&nbsp;:<br> <a href=""><%= Singleton.Local.get("day_"+today.get(Calendar.DAY_OF_WEEK)) + " " + dateFormat.format(today.getTime()) %></a></div>
						</div>
            <div class="last">
                <span class="first"></span>
                <span class="last"></span>
            </div>
        </div>
        
    
                <form method="post" action="">
        <input type=hidden name=".crumb" value="9yuiq1Z6LMk">
        <input type="hidden" name="in_titles" value="1" />
        <div class="modulecontainer sidebar quicksearch">
            <div class="first">
                <span class="first"></span>
                <span class="last"></span>
            </div>
            <div>
                <div class="hdr">
                    <strong><%= Singleton.Local.get("search_event") %></strong>
                </div>
                <div class="bdy">
                <input type="text" name="search_words" size="15"/>
                <button type="submit" name="SubmitSearch" value="Go">OK</button>
                </div>
                
            </div>
            <div class="last">
                <span class="first"></span>
                <span class="last"></span>
            </div>
        </div>
        </form>

    </td>
 


    <td valign="top" width="100%">
    <table cellpadding="0" cellspacing="0" width="100%" border="0">
    <tr>
    <td valign="top" colspan="3">
                    <div id="tabbackground">
                <div id="ymacalnav">
                    <span id="menu_day" class="bge"><a href="javascript:loadFragmentInToElement('main.jsp?view=day','calendar')"><%= Singleton.Local.get("title_day") %></a></span>
                    <span id="menu_week" class="bgf"><a href="javascript:loadFragmentInToElement('main.jsp?view=week','calendar')"><%= Singleton.Local.get("title_week") %></a></span>
                    <span id="menu_month" class="bge"><a href="javascript:loadFragmentInToElement('main.jsp?view=month','calendar')"><%= Singleton.Local.get("title_month") %></a></span>
                    <span id="menu_list" class="bge"><a href="javascript:loadFragmentInToElement('main.jsp?view=event','calendar')"><%= Singleton.Local.get("title_events") %></a></span>
                </div>
            </div>



    </td>
    </tr>
    <tr><td valign="top">

<div id="weekdataview">
                    <div id="calhdr">
        <span>
    
         

                                         <a href="javascript:loadFragmentInToElement('main.jsp?view=week&date=<%= prevLinkDate %>','calendar')"><img src="<%= libPath %>/images/leftl1.gif" 

width="16" height="16" border="0"></a>
                                        <a href="javascript:loadFragmentInToElement('main.jsp?view=week&date=<%= nextLinkDate %>','calendar')"><img src="<%= libPath %>/images/rightl1.gif" 

width="16" height="16" border="0"></a>
			<%=  dateFormat.format(week[0].getTime())%> - <%=  dateFormat.format(week[6].getTime())%>
                            
    </span>

         
        </div> 



            <table class="calendar" width="100%" id="weekdata" cellspacing="0" border="0">
                <colgroup>
        <col width="10%" />
        <col width="45%" />
        <col width="45%" />
    </colgroup>
                  


        <tbody>
                    <tr>
                <td class="daylabel calnone">
                    <div><%= Singleton.Local.get("day_1").substring(0,3).toLowerCase() %>
                                    <a href="javascript:loadFragmentInToElement('main.jsp?view=day&date=<%=  dateFormat.format(week[0].getTime())%>','calendar')"><%=  dateFormat.format(week[0].getTime())%></a></div>
                                     [<a href="form_add.jsp?date=<%=  dateFormat.format(week[0].getTime())%>"><%= Singleton.Local.get("add") %></a>]
                                                 </td>
                            <td style="width:100%;" class="calnone"><%= calendar.Display.weekEvent(week[0]) %></td>
                                        </tr>
            <tr>
                <td class="daylabel calnone">
                    <div><%= Singleton.Local.get("day_2").substring(0,3).toLowerCase() %>
                                    <a href="javascript:loadFragmentInToElement('main.jsp?view=day&date=<%=  dateFormat.format(week[1].getTime())%>','calendar')"><%=  dateFormat.format(week[1].getTime())%></a></div>
                                     [<a href="form_add.jsp?date=<%=  dateFormat.format(week[1].getTime())%>"><%= Singleton.Local.get("add") %></a>]
                                                 </td>
                            <td style="width:100%;" class="calnone"><%= calendar.Display.weekEvent(week[1]) %></td>
                                        </tr>
            <tr>
                <td class="daylabel calnone">
                    <div><%= Singleton.Local.get("day_3").substring(0,3).toLowerCase() %>
                                    <a href="javascript:loadFragmentInToElement('main.jsp?view=day&date=<%=  dateFormat.format(week[2].getTime())%>','calendar')"><%=  dateFormat.format(week[2].getTime())%></a></div>
                                     [<a href="form_add.jsp?date=<%=  dateFormat.format(week[2].getTime())%>"><%= Singleton.Local.get("add") %></a>]
                                                 </td>
                            <td style="width:100%;" class="calnone"><%= calendar.Display.weekEvent(week[2]) %></td>
                                        </tr>
            <tr>
                <td class="daylabel calnone">
                    <div><%= Singleton.Local.get("day_4").substring(0,3).toLowerCase() %>
                                    <a href="javascript:loadFragmentInToElement('main.jsp?view=day&date=<%=  dateFormat.format(week[3].getTime())%>','calendar')"><%=  dateFormat.format(week[3].getTime())%></a></div>
                                     [<a href="form_add.jsp?date=<%=  dateFormat.format(week[3].getTime())%>"><%= Singleton.Local.get("add") %></a>]
                                                 </td>
                            <td style="width:100%;" class="calnone"><%= calendar.Display.weekEvent(week[3]) %></td>
                                        </tr>
            <tr>
                <td class="daylabel calnone">
                    <div><%= Singleton.Local.get("day_5").substring(0,3).toLowerCase() %>
                                    <a href="javascript:loadFragmentInToElement('main.jsp?view=day&date=<%=  dateFormat.format(week[4].getTime())%>','calendar')"><%=  dateFormat.format(week[4].getTime())%></a></div>
                                     [<a href="form_add.jsp?date=<%=  dateFormat.format(week[4].getTime())%>"><%= Singleton.Local.get("add") %></a>]
                                                 </td>
                            <td style="width:100%;" class="calnone"><%= calendar.Display.weekEvent(week[4]) %></td>
                                        </tr>
            <tr>
                <td class="daylabel calnone">
                    <div><%= Singleton.Local.get("day_6").substring(0,3).toLowerCase() %>
                                    <a href="javascript:loadFragmentInToElement('main.jsp?view=day&date=<%=  dateFormat.format(week[5].getTime())%>','calendar')"><%=  dateFormat.format(week[5].getTime())%></a></div>
                                     [<a href="form_add.jsp?date=<%=  dateFormat.format(week[5].getTime())%>"><%= Singleton.Local.get("add") %></a>]
                                                 </td>
                            <td style="width:100%;" class="calnone"><%= calendar.Display.weekEvent(week[5]) %></td>
                                        </tr>
            <tr>
                <td class="daylabel calnone">
                    <div><%= Singleton.Local.get("day_7").substring(0,3).toLowerCase() %>
                                    <a href="javascript:loadFragmentInToElement('main.jsp?view=day&date=<%=  dateFormat.format(week[6].getTime())%>','calendar')"><%=  dateFormat.format(week[6].getTime())%></a></div>
                                     [<a href="form_add.jsp?date=<%=  dateFormat.format(week[6].getTime())%>"><%= Singleton.Local.get("add") %></a>]
                                                 </td>
                            <td style="width:100%;" class="calnone"><%= calendar.Display.weekEvent(week[6]) %></td>
                                        </tr>
            </tbody>
        </table>
                    <div class="contentnav">
            <span class="last">
        
            </span>
             
        </div>
<%@ include file="footer.jsp" %>




        </div>    </td>
</tr>
</table>
    </td></tr>
    </table>
    </td>
</tr>
</table>